﻿@model CSEPT.Models.PhotoViewModel
@{
    ViewBag.Title = "Event Overview";
}
<h2>@Model.Evnt.Title</h2>
<div class="col-xs-12">
    <p>@Model.Evnt.Description</p>
</div>
<div class="row">
    <div class="col-xs-12">
<hr class="divider" />
        </div>
</div>
<div class="row">
    <div class="col-xs-12">
        <a class="pull-right btn btn-lg btn-success" href="@Url.Action("Add", "Photo", new {@EventID = Model.Evnt.ID})">Upload Photos</a>
        <h2 class="pull-left">Photos</h2>
    </div>
</div>
@foreach (CSEPT.Photo Phto in Model.Photos)
{

    <div class="col-xs-12 col-sm-4 col-md-3 col-lg-2" style="">
        <div class="photo">
            <div class="links">
                @if (Phto.Photographer.ID == Model.CurrUser.ID)
                {
                    <a href="@Url.Action("Delete", "Photo", new { @PhotoID = Phto.ID, @EventID = Phto.PhotoEvent.ID })" style="margin-left: 5px;" class="btn btn-danger upload pull-left" data-toggle="tooltip" title="Delete Photo"><span class="glyphicon glyphicon-trash"></span></a>
                }
                <a href="@Url.Action("View", "Photo", new { @PhotoID = Phto.ID})" class="btn btn-default upload pull-right" data-toggle="tooltip" title="View Photo"><span class="glyphicon glyphicon-eye-open"></span></a>
                @if (Model.CurrUser.Credits > 2)
                {
                    <a target="_blank" onclick="location.reload();" href="@Url.Action("Download", "Photo", new { @PhotoID = Phto.ID})" class="btn btn-default upload pull-right" data-toggle="tooltip" title="Download Photo (3 Credits)"><span class="glyphicon glyphicon-download-alt"></span></a>
                }
                else
                {
                    <a  href="#" onclick="toastr.error($(this).data('original-title'))" class="btn btn-warning upload pull-right" data-toggle="tooltip" title="Insufficient Credits you must tag more photos to download this photo"><span class="glyphicon glyphicon-download-alt"></span></a>
                }
            </div>
            <div class="phto">
                <img src="@Url.Content("~/EventPhotos/" + Phto.ID + "_thumbnail.jpg")"  class="img-responsive" onclick="ShowModal(@Phto.ID)" />
            </div>
        </div>
    </div>
}
<script>
    $(function () {
        $('[data-toggle="tooltip"]').tooltip();
    })
</script>